﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mbine.msgc.model
{
    public sealed class CObserveRoster
    {
        static CObserveRoster instance = null;
        static readonly object padlock = new object();

        private List<IObserveRoster> ListRoster = new List<IObserveRoster>();
        CObserveRoster()
        {
        }

        public static CObserveRoster Instance
        {
            get
            {
                lock (padlock)
                {
                    if (instance == null)
                    {
                        instance = new CObserveRoster();
                    }
                    return instance;
                }
            }
        }

        public void Add(IObserveRoster _obs)
        {
            ListRoster.Add(_obs);
        }

        public void Update()
        {
            foreach (IObserveRoster obs in ListRoster)
                obs.UpdateRoster();
        }
    }
}
